﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
using ApiCoreProject.Dal;
using ApiCoreProject.Bll.Implement;
using ApiCoreProject.Bll.Interface;
using ApiCoreProject.Model.Entities;

namespace ApiCoreProject.Bll
{
    //寄存器
    public class DIBllRegister
    {
        /// <summary>
        /// 依赖注入服务
        /// </summary>
        /// <param name="services">依赖注入 IOC 容器</param>
        public void DIRegister(IServiceCollection services)
        {
            //在IOC 容器中添加 上下文
            services.AddDbContext<BaseDBContext>();

            // 用于实例化BaseDal对象，获取上下文对象
            services.AddTransient(typeof(IBaseDal<>), typeof(BaseDal<>));

            // 配置依赖注入映射关系 
            services.AddTransient(typeof(IImgaesServe), typeof(ImagesServe)); //图片
            services.AddTransient(typeof(IUsersServe), typeof(UsersServe)); //用户
            services.AddTransient(typeof(IMenusServe), typeof(MenusServe)); //菜单
            services.AddTransient(typeof(IAuthorityServe), typeof(AuthorityServe)); //权限
            services.AddTransient(typeof(IOrganizationServe), typeof(OrganizationServe)); //组织结构



        }
    }
}
